line1 = input().split(' ')
n, v = int(line1[0]), int(line1[1])

things = []
for i in range(n):
    line = input().split(' ')
    things.append((int(line[0]), int(line[1])))

things.sort(key=lambda x:x[0]/x[1])

worth = 0
v_all = 0
for t in things:
    v_all += t[0]
    if v_all > v:
        break
    else:
        worth += t[1]
print(worth)

10 20
2 5
3 5
4 7
1 2         
4 8
3 8
3 5
2 6
6 9
7 11